<?php

class LogController extends Controller_Action {
    
    
    public $menus = array (
                             'Action Menu' => array (
                                                        'list' => array (
                                                                'url'    => '/log/list',
                                                                'label'  => 'List'
                                                              ),
                                                        'add' => array (
                                                                'url' => '/log/add',
                                                                'label'  => 'Add'
                                                              ),
                                                        'view' => array (
                                                                'url' => '/log/view',
                                                                'label'  => 'View'
                                                              ),
                                                    ),
                          );
    protected $_templateFile = 'Log.html';
    
    public function indexAction() {
        $this->output = 'Logi';
    }
    
    public function listAction() {
        unset ($this->_templateFile);
    }
    
    public function viewAction() {
        $this->output = 'View';
    }
    
    public function addAction() {
        $log = epManager::instance()->create('BO_Log');
        $log->name  = $this->_request->logName;
        $log->score = 1;
        $log->user  = $this->_session->loggedUser;
        //->logs[] = $log;
    }
    
    public function AJAXListAction() {
        unset ($this->_templateFile);
        
        $logs = $this->_session->loggedUser->getLogs();
        $logArray = array();
        foreach ($logs as $log) {
            $logArray[$log->uuid] = $log->name;
        }
       
        $this->ajaxResponse = Zend_Json::encode($logArray);
        
    }
    
    protected function _prepareMenu() {
       $this->menus['Action Menu'][$this->_action->getActionName()]['selected'] = true;
    }
    
    

}

?>